<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改服务2')" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-service2-edit" th:object="${zknjService}">
        <input name="serId" th:field="*{serId}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">名称：</label>
            <div class="col-sm-8">
                <input name="serName" th:field="*{serName}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">描述：</label>
            <div class="col-sm-8">
                <input name="serDes" th:field="*{serDes}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">状态：</label>
            <div class="col-sm-8">
                <label class="toggle-switch switch-solid">
                    <input type="checkbox" id="status" th:checked="*{isLock==0}">
                    <span></span>
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">服务类型：</label>
            <div class="col-sm-8">
                <select name="serTypeId" class="form-control selectpicker" data-size="10">
                    <option th:each="serviceTypes:${zkServiceTypes}" th:value="${serviceTypes.svtypeId}" th:text="${serviceTypes.svtypeName}"
                            th:data-subtext="${serviceTypes.svtypeDescription}" th:disabled="${serviceTypes.svtypeStatus != 0}" th:field="*{serTypeId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">仪器：</label>
            <div class="col-sm-8">
                <select name="instId" class="form-control selectpicker" data-size="10">
                    <option th:each="instrument:${instruments}" th:value="${instrument.instId}" th:text="${instrument.instName}"
                            th:data-subtext="${instrument.hostId}" th:disabled="${instrument.status != 0}" th:field="*{instId}"></option>
                </select>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/service2";
    $("#form-service2-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            var data = $('#form-service2-edit').serializeArray();
            var status = $("input[id='status']").is(':checked') == true ? 0 : 1;
            data.push({"name": "serStatus", "value": status});
            $.operate.save(prefix + "/edit", data);
        }
    }
</script>
</body>
</html>